package cn.dlc.com.rmi.config;

import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;

import cn.dlc.com.rmi.server.UserService;
import cn.dlc.com.rmi.server.impl.UserServiceImpl;

public class AppConfig {

	public void startRMI() throws Exception{
		// 启动rmi注册服务，指定端口号
		LocateRegistry.createRegistry(8888);
		// 创建要被访问的远程对象的实例
		UserService userService = new UserServiceImpl();
		// 注册服务
		Naming.bind("rmi://localhost:8888/UserService", userService);
		// 输出提示
		System.out.println("starting......");
	}
}
